#include <stdio.h>

int main(int argc, char *argv[])
{

    int n = 0, flag = 1;
    scanf("%d", &n);
    while (n--)
    {
        int size = 0;
        scanf("%d", &size);
        int nums[size];
        for (size_t i = 0; i < size; i++)
            scanf("%d", &nums[i]);

        for (size_t i = 1; i < 9999; i++)
        {
            for (size_t k = 0; k < size; k++)
            {
                if(i%nums[k]!=0){
                    flag = 0;
                }
            }
            if(flag){
                printf("%lld\n", i);
                break;
            }
            flag = 1;
        }

    }

    return 0;
}